package com.ocom.srvpaccess.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ocom.common.entity.master.EntityMngUserInfo;
import com.ocom.common.enums.DataSourceEnum;
import com.ocom.common.enums.MasterSlaveEnum;
import com.ocom.common.utils.StringUtils;
import com.ocom.mysql.aspect.DataSourceAspect;
import com.ocom.srvpaccess.dao.IDaoMngUserInfo;
import com.ocom.srvpaccess.service.MngUserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MngUserInfoServiceImpl extends ServiceImpl<IDaoMngUserInfo, EntityMngUserInfo> implements MngUserInfoService {

    @Autowired
    private IDaoMngUserInfo iDaoMngUserInfo;


    @DataSourceAspect(type = DataSourceEnum.MAIN_DB,isMaster = MasterSlaveEnum.SLAVE)
    @Override
    public List<EntityMngUserInfo> selectList(Long comId, List<String> roles) {
        QueryWrapper<EntityMngUserInfo> query = Wrappers.query();
        query.eq("com_id",comId);
        query.in("roles",roles);
        return iDaoMngUserInfo.selectList(query);
    }
}
